#include<bits/stdc++.h>
using namespace std;
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
const int N=2e5+5;
typedef vector<int> vi; 
#define pb push_back
typedef long long ll;
typedef long double ld; 
typedef vector<int>  vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int main()
{
    map<string,int>st;
    int res=0;
    for(int i=0;i<4;i++){
        string x;
        cin>>x;
        st[x]++;
    }
    for(auto c:st){
        if(c.first=="H"||c.first=="HR"||c.first=="2B"||c.first=="3B")
            continue;
        else{
            cout<<"No";
            return 0;
        }
    }
    if(st.size()==4)
    cout<<"Yes";
    else
    cout<<"No";
}